package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.ExtIotSceneStructure;
import com.econ.powercloud.ems.dal.entity.ext.SceneStructure;
import com.econ.powercloud.ems.dal.mapper.ExtIotSceneStructureMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author : zjf
 * @Description :
 * @Date : 2022/2/18 8:57
 * @Modified by : zjf
 */
@Repository
public class ExtIotSceneStructureDAO extends ServiceImpl<ExtIotSceneStructureMapper, ExtIotSceneStructure> {

    public List<SceneStructure> selectSceneStructureListBySceneCode(String sceneCode) {
        return this.baseMapper.selectSceneStructureListBySceneCode(sceneCode);
    }

    public List<ExtIotSceneStructure> selectListBySceneCode(String sceneCode) {
        LambdaQueryWrapper<ExtIotSceneStructure> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(ExtIotSceneStructure::getSceneCode, sceneCode);
        return this.baseMapper.selectList(lambdaQueryWrapper);
    }

    public ExtIotSceneStructure selectByNodeId(String nodeId) {
        LambdaQueryWrapper<ExtIotSceneStructure> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(ExtIotSceneStructure::getNodeId, nodeId);
        return this.baseMapper.selectOne(lambdaQueryWrapper);
    }
}
